package com.zerowidth.moc.web.controller;

import com.zerowidth.db.bean.MallBean;
import com.zerowidth.db.bean.TeachBean;
import com.zerowidth.db.bean.YiYuanDuoBaoBean;
import com.zerowidth.moc.web.auth.annotation.NoToken;
import com.zerowidth.moc.web.bean.YsePayBean;
import com.zerowidth.moc.web.controller.service.MallService;
import com.zerowidth.moc.web.resp.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import jakarta.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/api/v1")
public class MallController {

    @Autowired
    MallService mallService;

    @NoToken
    @GetMapping("/mall/goods_list")
    public ResponseEntity<ResultBean<List<MallBean>>> getMallList(
            HttpServletRequest request) {
        return mallService.getMallList();
    }


    /**
     * 微信APP支付创建购买 相机神器会员订单
     */
    @NoToken
    @PostMapping("/mall_order/wx")
    public ResponseEntity<ResultBean<YsePayBean>> createWXOrder(
            HttpServletRequest request,
            @RequestParam("mall_id") int mall_id,
            @RequestParam("mall_time_type") int mall_time_type,
            @RequestParam("price") String price
            ) {
        return mallService.createWXOrder(request, mall_id, mall_time_type, price);
    }


}
